<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>后台管理</title>
{{include file="layouts/_head"}}
</head>
<body>
<div class="main">
	<ol class="breadcrumb">
		<li><i class="icon_home iconfont"></i>首页</li>
	  	<li>用户管理</li>
	  	<li><a href="javascript:history.go(-1);">用户列表</a></li>
	  	<li class="active">编辑信息</li>
	</ol>
	<div class="bg-danger clearfix main-head-info error-info"></div>
	<div class="main-con">
		<form class="form-horizontal margin-t-30" id="form" method="post" action="{{:url('/admin/user/update')}}" >
			<input type="hidden" name="id" value="{{$user.id}}">
		  	<div class="tab-box">
		  		<div class="form-group">
			    	<span class="col-sm-2 control-label">ID：</span>
			    	<div class="col-sm-8 input-group">
			    		<p class="form-control-static">{{$user.id}}</p>
			    	</div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label">昵称：</span>
			    	<div class="col-sm-8 input-group">
			    		<p class="form-control-static">{{$user.nickname}}</p>
			    	</div>
			  	</div>
			  	<div class="form-group">
                    <span class="col-sm-2 control-label">头像：</span>
                    <div class="col-sm-4 input-group">
                    	{{if !empty($user.avatar)}}
                    	<img src="{{$user.avatar}}" class="wh-80x80">
                    	{{else}}
                    	<p class="form-control-static">未上传</p>
                    	{{/if}}
                    </div>
                </div>
                <div class="form-group">
			    	<span class="col-sm-2 control-label">电话：</span>
			    	<div class="col-sm-8 input-group">
			    		<p class="form-control-static">{{$user.phone}}</p>
			    	</div>
			  	</div>
			  	<div class="form-group">
			    	<span class="col-sm-2 control-label">邮箱：</span>
			    	<div class="col-sm-8 input-group">
			    		<p class="form-control-static">{{$user.email ? $user.email : '未填写'}}</p>
			    	</div>
			  	</div>
                <div class="form-group">
				    <span class="col-sm-2 control-label">余额：</span>
				    <div class="col-sm-2 input-group">
				      <input class="form-control" name="wallet" value="{{$user.wallet}}">
				    </div>
				</div>
			  	<div class="form-group">
				    <span class="col-sm-2 control-label">状态：</span>
				    <div class="col-sm-2 input-group">
					<select class="form-control" name="status">
						<option value="1" {{if $user.status == 1}}selected="true"{{/if}}>开启</option>
						<option value="0" {{if $user.status == '0'}}selected="true"{{/if}}>关闭</option>
					</select>
				    </div>
			  	</div>
			</div>
			<div class="foot_btn_blank"></div>
            <div class="foot_btn">
                <div class="box">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </div>
		</form>
	</div>
</div>
{{include file="layouts/_foot"}}
{{include file="shared/_jquery_validation"}}
<script type="text/javascript">
$("#form").validate({
    submitHandler:function(){
        layer.confirm('确认提交？', {
            btn: ['确认','取消']
        }, function(){
            var load = layer.load();
            $("#form").ajaxSubmit(function(data) {
                layer.close(load);
                if (data.code == 401) {
                    goLogin();
                } else if (data.code == 200) {
                    layer.msg('提交成功', {time: 1500}, function() {window.location.reload();});
                } else if (data.code == 400) {
                    layer.msg(data.message);
                } else {
                    layer.msg('操作失败');
                }
            });
        }); 
    },
    invalidHandler: function(form, validator) {
         goTop();
    }
});
</script>
</body>
</html>